<?php
class Application_Service_Downloadfile
{
	function downloads($path,$name){	
		
		if (!file_exists($path)){
			header("Content-type: text/html; charset=utf-8");
			echo "File not found!";
			exit; 
		} else {
			//$file = fopen($path,"r"); 
			Header("Content-type: application/octet-stream");
			Header("Accept-Ranges: bytes");
			Header("Accept-Length: ".filesize($path));
			Header("Content-Disposition: attachment; filename=".$name);
			//echo fread($file, filesize($path));
			//fclose($file);
			readfile($path);
		}
	}
}